# Maintainer: Ryuta Suzuki <oroppas@gmail.com>

_realname=pickleshare
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}" "${MINGW_PACKAGE_PREFIX}-python2-${_realname}")
pkgver=0.7.4
pkgrel=2
pkgdesc="File system based database that uses python pickles (mingw-w64)"
url="https://github.com/pickleshare/pickleshare"
arch=('any')
license=('MIT')
makedepends=("${MINGW_PACKAGE_PREFIX}-python3-setuptools"
             "${MINGW_PACKAGE_PREFIX}-python2-setuptools")
checkdepends=("${MINGW_PACKAGE_PREFIX}-python3-nose"
              "${MINGW_PACKAGE_PREFIX}-python2-nose")
source=("${_realname}-${pkgver}.tar.gz::https://github.com/${_realname}/${_realname}/archive/${pkgver}.tar.gz")
sha256sums=('a9ccf2c87c2224f26dd5b7dfd135f2472e374ae972f8d510b1b940861beb1eb4')

prepare() {
  cp -a ${_realname}-${pkgver}{,-py2}
}

build() {
  cd ${srcdir}/${_realname}-${pkgver}
  python3 setup.py build

  cd ${srcdir}/${_realname}-${pkgver}-py2
  python2 setup.py build
}

check() {
    cd ${srcdir}/${_realname}-${pkgver}
    nosetests-3.6

    cd ${srcdir}/${_realname}-${pkgver}-py2
    nosetests-2.7
}

package_python3-pickleshare() {
  depends=("${MINGW_PACKAGE_PREFIX}-python3-path>=8.1")

  cd ${srcdir}/${_realname}-${pkgver}
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python3 setup.py install --root=${pkgdir} --prefix=${MINGW_PREFIX} --optimize=1
  install -Dm644 LICENSE ${pkgdir}${MINGW_PREFIX}/share/licenses/python3-${_realname}/LICENSE
}

package_python2-pickleshare() {
  depends=("${MINGW_PACKAGE_PREFIX}-python2-path>=8.1")

  cd ${srcdir}/${_realname}-${pkgver}-py2
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python2 setup.py install --root=${pkgdir} --prefix=${MINGW_PREFIX} --optimize=1
  install -Dm644 LICENSE ${pkgdir}${MINGW_PREFIX}/share/licenses/python2-${_realname}/LICENSE
}

package_mingw-w64-i686-python2-pickleshare() {
  package_python2-pickleshare
}

package_mingw-w64-i686-python3-pickleshare() {
  package_python3-pickleshare
}

package_mingw-w64-x86_64-python2-pickleshare() {
  package_python2-pickleshare
}

package_mingw-w64-x86_64-python3-pickleshare() {
  package_python3-pickleshare
}

# vim:set ts=2 sw=2 et:
